from django.urls import path, include
from rest_framework.routers import DefaultRouter
from . import views

router = DefaultRouter()
router.register(r'tasks', views.TaskViewSet)

urlpatterns = [
    # API URLs
    path('api/', include(router.urls)),
    path('', views.TaskListView.as_view(), name='task-list'),
    path('task/<int:pk>/', views.TaskDetailView.as_view(), name='task-detail'),
    path('task/new/', views.TaskCreateView.as_view(), name='task-create'),
    path('task/<int:pk>/edit/', views.TaskUpdateView.as_view(), name='task-update'),
    path('task/<int:pk>/delete/', views.TaskDeleteView.as_view(), name='task-delete'),
    path('register/', views.register, name='register'),
    path('task_done/<int:pk>/', views.task_done, name='task-done'),
    path('task_progress/<int:pk>/', views.task_progress, name='task-progress'),
    path('task/image/<int:pk>/delete/', views.delete_task_image, name='delete-task-image'),
    path('user-center/', views.UserCenterView.as_view(), name='user-center'),
    path('user-profile/update/', views.UserProfileUpdateView.as_view(), name='user-profile-update'),
    path('get_info_from_api/', views.get_info_from_api, name='get_info_from_api'),
    path('tasks/export/', views.ExportTasksView.as_view(), name='export-tasks'),
    path('tasks/export-form/', views.ExportTasksFormView.as_view(), name='export-tasks-form'),
    path('nopage/', views.not_found_view, name='nopage'),
    path('dashboard/', views.dashboard, name='dashboard'),
    path('import-data/', views.import_excel, name='import-data'),
    path('export-tep/', views.export_template, name='export-tep'),
    # 测试钉钉通知功能
    path('test-dingtalk/', views.test_dingtalk_notification, name='test-dingtalk'),
    # 测试任务到期提醒功能
    path('test-due-tasks/', views.test_due_tasks_notification, name='test-due-tasks'),

]
